import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import vue from '@vitejs/plugin-vue';
import path from 'path';
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import vueSetupExtend from 'vite-plugin-vue-setup-extend'

export default defineConfig({
    plugins: [
        laravel({
            input: [
                'resources/css/app.css',
                'resources/js/app.js',
            ],
            refresh: true,
        }),
        vue(),
        vueSetupExtend(),
        AutoImport({
            imports: [
                // 自动导入 Vue 相关函数
                'vue',
            ],
        }),
        Components({
            resolvers: [
                // 自动导入组件
            ],
        }),
    ],
    resolve: {
        alias: {
            '@': path.resolve(__dirname, 'resources/js'),
            '@Admin': path.resolve(__dirname, 'Modules/Admin/resources/js'),
        },
    },
    server: {
        cors: true,
        host: 'thinkcms.net',
        port: 5173,
        strictPort: true,
        hmr: {
            host: 'thinkcms.net',
            protocol: 'ws',
        },
    },
});
